<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/9/14
 * Time: 17:23
 * Description: 供应商物流运费“按门店设置”扩展表
 */
class MaintenanceSupplierLogisticsFreightShop extends Eloquent
{
    protected $table = "maintenance_supplier_logistics_freight_shop";

    /**
     * @Author:          zk
     * @DateTime:        18-9-15 上午10:56
     * @Description:     根据供应商ID获取该供应商物流运费“按门店设置”的列表
     * @param int $supplier_id  供应商ID
     * @return array
     */
    public static function getShopList($supplier_id) {
        $select_arr = [
            'shop.supplier_id', 'shop.shop_id', 'shop.logistics_freight', 
            'maintenance_shops.name AS shop_name', 
        ];
        $list = DB::table('maintenance_supplier_logistics_freight_shop AS shop')
                ->leftJoin('maintenance_shops', 'shop.shop_id', '=', 'maintenance_shops.id')
                ->select($select_arr)
                ->where('shop.supplier_id', $supplier_id)
                ->get();
        return $list;
    }
    
}